package org.example.config.conditional.apm;

import org.example.config.conditional.apm.beans.MockUser;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

@Configuration
public class ApmAutoConfig {
    @Profile("test")
    @ConditionalOnProperty(prefix = "spring.profiles", name = "active", havingValue = "test")
    @Bean
    @ConditionalOnMissingBean(MockUser.class)
    public MockUser mockUser2() {
        return new MockUser();
    }
}